package com.carpedil.shirodemo.system.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author carpedil
 * @since 2021-01-05
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Component
public class Menu extends Model {

  private static final long serialVersionUID = 1L;

  /** 菜单 ID */
  @TableId(value = "menu_id", type = IdType.AUTO)
  private Integer menuId;

  private Integer parentId;

  /** 菜单名称 */
  private String menuName;

  /** 菜单 URL */
  private String url;

  /** 权限标识符 */
  private String perms;

  /** 排序 */
  private Integer orderNum;

  /** 创建时间 */
  private LocalDateTime createTime;

  /** 修改时间 */
  private LocalDateTime modifyTime;

  /** 图标 */
  private String icon;

  @TableField(exist = false)
  @JsonInclude(JsonInclude.Include.NON_EMPTY)
  private List<Menu> children;

  /** 树状菜单复选框需要的属性 */
  @JsonInclude(JsonInclude.Include.NON_NULL)
  @TableField(exist = false)
  private String checkArr = "0";
}
